#!/bin/sh
# Generate initrd using Dracut.
if [ -x /usr/bin/dracut ]; then
    for i in /usr/lib/modules/*; do
        case $i in (*extramodules*) continue;; esac
        echo -e "\033[36m**\033[0m\tGenerating initrd (Initialization RAM Disk) for kernel version $i ..."
        dracut -q --force /boot/initramfs-"$i".img "$i"
    done
else
    echo -e "\033[33m**\033[0m\tCommand \"dracut\" is not installed, skipping generation.\n\tYou may not be able to boot the new kernel on the next boot."
fi

# TODO: Support for multiple other initramfs/initrd manager.
# TODO: Write in signal for PS1 to show "reboot" demand.
